package com.kmproject.haifu.mvp.model;

import android.app.Application;

import com.google.gson.Gson;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import com.jess.arms.di.scope.FragmentScope;

import javax.inject.Inject;

import com.kmproject.haifu.mvp.contract.MoreHousePublishSecondHouseContract;
import com.kmproject.haifu.mvp.model.api.service.SecondhandService;
import com.kmproject.haifu.mvp.model.api.service.UserService;
import com.kmproject.haifu.mvp.model.entity.ResultBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.SecondHandInfoBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 07/17/2019 22:01
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@FragmentScope
public class MoreHousePublishSecondHouseModel extends BaseModel implements MoreHousePublishSecondHouseContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public MoreHousePublishSecondHouseModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<ResultBean<List<SecondHandInfoBean>>> mySecondHandList(Map<String, Object> maps) {
        return mRepositoryManager.obtainRetrofitService(SecondhandService.class).mySecondHandList(creatRequestBody(maps,mGson));
    }

    @Override
    public Observable<ResultBean> lowerShelfSecondHand(String lowerShelfReason, String secondHandId) {
        return mRepositoryManager.obtainRetrofitService(SecondhandService.class).lowerShelfSecondHand(lowerShelfReason,secondHandId);
    }

    @Override
    public Observable<ResultBean<List<HousePayWayBean>>> dictList(String value, String category) {
        return mRepositoryManager.obtainRetrofitService(UserService.class).dictList(value,category);
    }

    @Override
    public Observable<ResultBean> remoredSencond(String secondHandId) {
        return mRepositoryManager.obtainRetrofitService(SecondhandService.class).remoredSencond(secondHandId);
    }
}